<template>
  <div class="_container" style="height: auto;overflow: hidden;padding: 15px;">
    <!--工具栏-->
    <el-card shadow="hover" style="margin-bottom: 15px;">
      <div>
        <el-row style="line-height: 40px;">
          <el-col :span="5" :xs="24" class="_search-box">
            <div style="float: left;width: 60px;">
              <span>关键字：</span>
            </div>
            <el-input
              placeholder="请输入关键字"
              style="width: 70%;margin-left: 10px;"
              v-model="inputValue"
            ></el-input>
          </el-col>
          <el-col :span="5" :xs="24" class="_search-box">
            <div style="float: left;width: 60px;">
              <span>日期查询：</span>
            </div>
            <el-date-picker
              v-model="dateValue"
              type="daterange"
              align="right"
              unlink-panels
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              :picker-options="pickerOptions"
              style="width: 70%;margin-left: 10px;"
            ></el-date-picker>
          </el-col>
          <el-col :span="5" :xs="24" class="_search-box">
            <div style="float: left;width: 60px;">
              <span>关键字：</span>
            </div>
            <el-input
              placeholder="请输入关键字"
              style="width: 70%;margin-left: 10px;"
              v-model="inputValue1"
            ></el-input>
          </el-col>
          <el-col :span="5" :xs="24" class="_search-box">
            <div style="float: left;width: 60px;">
              <span>关键字：</span>
            </div>
            <el-input
              placeholder="请输入关键字"
              style="width: 70%;margin-left: 10px;"
              v-model="inputValue1"
            ></el-input>
          </el-col>
          <el-col :span="4" :xs="24" class="_search-box">
            <div style="width: 100%;text-align: right;">
              <el-button icon="el-icon-refresh-left">重置</el-button>
              <el-button type="primary" icon="el-icon-search">查询</el-button>
              <!-- <el-dropdown>
                <el-button type="primary" plain>
                  更多
                  <i class="el-icon-arrow-down el-icon--right"></i>
                </el-button>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item>黄金糕</el-dropdown-item>
                  <el-dropdown-item>狮子头</el-dropdown-item>
                  <el-dropdown-item>螺蛳粉</el-dropdown-item>
                  <el-dropdown-item>双皮奶</el-dropdown-item>
                  <el-dropdown-item>蚵仔煎</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>-->
            </div>
          </el-col>
        </el-row>
      </div>
    </el-card>
    <el-card shadow="hover">
      <div style="width: 100%;margin-top: 10px;">
        <el-row>
          <el-col :span="12">
            <el-switch v-model="switchValue" active-text="按月付费" inactive-text="按年付费"></el-switch>
          </el-col>
          <el-col :span="12" style="text-align: right;">
            <el-button-group>
              <el-button size="mini" @click="$refs.pageForm.dialogFormVisible = true">新增</el-button>
              <el-button size="mini" type="danger">按钮2</el-button>
            </el-button-group>
            <el-dropdown>
              <el-button size="mini" type="primary" plain>
                更多
                <i class="el-icon-arrow-down el-icon--right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>黄金糕</el-dropdown-item>
                <el-dropdown-item>狮子头</el-dropdown-item>
                <el-dropdown-item>螺蛳粉</el-dropdown-item>
                <el-dropdown-item>双皮奶</el-dropdown-item>
                <el-dropdown-item>蚵仔煎</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-col>
        </el-row>
      </div>
      <div style="margin: 24px 0;">
        <el-divider>查询结果</el-divider>
      </div>
      <div style="margin-bottom: 15px;">
        <el-table :data="tableData" ref="multipleTable" stripe>
          <el-table-column type="selection" width="55"></el-table-column>
          <el-table-column prop="date" label="日期" width="150"></el-table-column>
          <el-table-column prop="name" label="姓名"></el-table-column>
          <el-table-column prop="province" label="省份"></el-table-column>
          <el-table-column prop="city" label="市区"></el-table-column>
          <el-table-column prop="address" label="地址"></el-table-column>
          <el-table-column prop="zip" label="邮编"></el-table-column>
          <el-table-column fixed="right" label="操作" width="100">
            <template slot-scope="scope">
              <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
              <el-button type="text" size="small">编辑</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>

      <nav style="text-align: center">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[100, 200, 300, 400]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="400"
        ></el-pagination>
      </nav>
    </el-card>
    <pageForm ref="pageForm"></pageForm>
  </div>
</template>

<script>
import pageForm from "./pageForm.vue";
export default {
  components: { pageForm },
  methods: {
    handleClick(row) {
      console.log(row);
    }
  },

  data() {
    return {
      switchValue: true,
      dateValue: "",
      inputValue: "",
      inputValue1: "",
      currentPage: 1, //当前页
      pickerOptions: {
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            }
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            }
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            }
          }
        ]
      },
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1517 弄",
          zip: 200333
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1519 弄",
          zip: 200333
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1516 弄",
          zip: 200333
        }
      ]
    };
  },
  methods: {
    onSubmit() {},
    handleSizeChange(param) {
      console.log(param);
    },
    handleCurrentChange(param) {
      console.log(param);
    }
  }
};
</script>
<style scoped>
._search-box {
  margin: 10 0;
}
</style>